﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace BCDEditUI
{
    public partial class ucAddBootableVhd : UserControl
    {
        public ucAddBootableVhd()
        {
            InitializeComponent();
        }

        public Form1 MainForm
        {
            get
            {
                return ParentForm as Form1;
            }
        }

        private void btnAddVhd_Click(object sender, EventArgs e)
        {
            MainForm.Output = BcdEdit.AddVhd(MainForm.FileName, tbName.Text);
        }

        public void VhdSelected(string vhd)
        {
            if (string.IsNullOrEmpty(tbName.Text))
            {
                tbName.Text = Path.GetFileName(vhd);
            }

        }

        public void SetArgs(string[] args)
        {
                string arg = string.Join(" ", args, 1, args.Length - 1);

                MainForm.FileName = arg;
                tbName.Text = Path.GetFileName(arg);
        }
    }
}
